const electron = require("electron");
const { spawn } = require("child_process");
const Webpack = require("webpack");
const electronConfig = require("../config/webpack.electron.config");
module.exports = function startElectron() {
  electronConfig.mode = "development";
  Webpack(electronConfig).watch(
    {
      aggregateTimeout: 1000,
    },
    (err, stats) => {
      if (err) {
        console.log(err);
        return;
      }
    }
  );
  let electronProcess = spawn(electron, ["."]);
  electronProcess.on("close", () => {
    process.exit();
  });
};
